import copy
def BellmanFord(edges_value, N, src, dst, k):
    min_dist = [float('inf')] * (N+1)
    min_dist_new = [float('inf')] * (N+1)
    
    min_dist_new[src] = 0
    
    for _ in range(k+1):
        min_dist = copy.deepcopy(min_dist_new)
        
        for s,t,value in edges_value:
            if min_dist[s] != float('inf') and min_dist[s]+value < min_dist_new[t]:
                min_dist_new[t] = min_dist[s]+value
    
    return min_dist_new[dst]



def main():
    N, M = map(int, input().split())
    edges_value = []
    for i in range(M):
        edges_value.append(list(map(int, input().split())))
    
    src, dst, k = map(int, input().split())
    
    min_cost = BellmanFord(edges_value, N, src, dst, k)
    if min_cost == float('inf'):
        print("unreachable")
    else:
        print(min_cost)

main()